/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-05-21
 * Time: 16:16
 */
public class massage {
    public static int massage(int[] nums) {
        // 1. 创建⼀个 dp 表
        // 2. 初始化
        // 3. 填表
        // 4. 返回值
        int n = nums.length;
        int[][] dp = new int[n][2];
        if(n==0)return 0;
        dp[0][0] = nums[0];
        for (int i = 1; i < n; i++) {
            dp[i][0] = dp[i-1][1] + nums[i];
            dp[i][1] = Math.max(dp[i - 1][1], dp[i - 1][0]);
        }
        return Math.max(dp[n - 1][0], dp[n - 1][1]);

    }

    public static void main(String[] args) {
        int[] nums={1,2};
        massage(nums);
    }
}
